<?php

namespace App\Http\Controllers\Api\V1;

use App\Http\Requests\MatchOrderRequest;
use App\Models\MatchOrder;
use App\Models\TradeQueue;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;

class MatchOrderController extends Controller
{
    // 手动匹配
    public function store(MatchOrderRequest $request)
    {
        $type = $request->input('type');
        $tradeQueue = new TradeQueue();
        switch ($type)
        {
            case 'deposit':
                $withdrawTradeQueueId = $request->withdraw_trade_queue_id;
                $depositTradeQueueId = $request->deposit_trade_queue_id;
//                $deposit_trade_queue_id = [26,28,29,30];//$request->deposit_trade_queue_id;
                return $tradeQueue->depositMatchOrders($depositTradeQueueId,$withdrawTradeQueueId);
            case 'withdraw':
                $depositTradeQueueId = $request->deposit_trade_queue_id;
                $withdrawTradeQueueId = $request->withdraw_trade_queue_id;
//                $withdraw_trade_queue_id = [26,28,29,30];//$request->deposit_trade_queue_id;
                return $tradeQueue->withdrawMatchOrders($depositTradeQueueId,$withdrawTradeQueueId);
            default:
                return false;
        }

    }
}
